home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctjjl86.arc
/
ANIMATE.ARC
/
INLINXOR.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-04-16
|
3KB
|
97 lines
; *** Listing 6 ***
;
;Column inline code XOR graphics driver for putting rectangular
; imagesinto the CGA's medium-resolution memory map.
;
; Note: AX,BX,CX,DX,BP,SI,DI destroyed.
;
one segment para public 'CODE'
assume cs:one,ds:one,es:nothing
public form_driver
;
form_driver proc near
mov di,[bx+even_line_screen_offset_table] ;find offset of
; top line of image
add di,cx ;ES:DI now points to byte at which to put
; the image's upper left corner
lodsb ;get the height of the image
xor ah,ah ;make height into 16 bit value
shr ax,1 ;divide by 2 to arrive at number of even/odd
; line pairs in the image
mov cx,ax ;store count in CX
lodsb ;get the width of the image in bytes
mov bp,2000h ;calculate the amount to add after even scan
sub bp,ax ; lines are drawn to get to address of the
; next scan line
mov dx,1fb0h ;calculate amount to subtract after odd scan
add dx,ax ; lines are drawn to get to the address of
; the next scan line
mov bx,ax ;number of columns in image
shl bx,1 ;convert into word table index
mov bx,[bx+column_inline_vector_table-2]
;
;Code for calculating the memory address to start each line of the
; image, and calling the inline code which exclusive-ORs a line of the
; image into the screen
;
next_two_lines:
call bx ;BX holds address of inline columns code
add di,bp ;calculate address to start next line of image
call bx ;process image for odd scan line
sub di,dx ;calculate address to start next line of image
; the next line will be an even line
loop next_two_lines ;loop if any even/odd line pairs left
ret ; if not, return to calling program
;
;Inline code for XORing a line of the image into the screen
;
clabel macro x ;this macro is used to label the inline code
cline&x&: ; entry points for number of columns to XOR
endm ;
;
x=10 ;this code can handle an image up to
rept 10 ; 10 bytes wide
clabel %x ;put in label for entry based on number of
; bytes in a column
lodsb ;get the next byte from the object's image
xor es:[di],al ; and XOR it with the value now at the
; screem position.
inc di ;point to next image byte in object's form
x=x-1 ;adjust label number
endm
ret ;this return is executed at the end of
; every line
;
;This table is used as an indirect address for jumping into
; the inline code for exclusive-ORing columns.
;
column_inline_vector_table label word ;there is no entry point for
; 0 lines. Starting at 2
; eliminates the need to
; store a dummy entry point
; address
column_entry_address macro x ;this macro is used to
dw cline&x& ; generate the labels
endm ; correspinding to the inline
; code entry points
;
x=1
rept 10
column_entry_address %x
x=x+1
endm
;
;This table is used to find the offset of an even scan line in
; the memory map of the color graphics adapter in medium res mode.
;
even_line_screen_offset_table label word
x=0
rept 100 ;there are 100 even lines
dw x*50h ; each is 50h (80 decimal) long
x=x+1
endm
;
form_driver endp
one ends
end